package com.zhkj.txg.module.mine.adapter

import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.txg.R
import com.zhkj.txg.module.mine.entity.MineCateEntity

class MineCateAdapter : BaseQuickAdapter<MineCateEntity, BaseViewHolder>(R.layout.item_mine_cate) {
    init {
        addChildClickViewIds(R.id.tvTitle)
    }
    override fun convert(helper: BaseViewHolder, item: MineCateEntity) {
        ContextCompat.getDrawable(context, item.resId)?.let {
            it.setBounds(0, 0, it.intrinsicWidth, it.intrinsicHeight)
            helper.setText(R.id.tvTitle, item.name).getView<TextView>(R.id.tvTitle)
                .setCompoundDrawablesRelative(null, it, null, null)
        }
    }
}